const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    publicUrl: app.globalData.publicUrl,
    order_id:'',
    bpj_uid:'',
    title:'',
    name:'',
   

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    that.setData({
      order_id: options.order_id,
      bpj_uid: options.bpj_uid,
      title: options.title,
      name: options.name
    })
   
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },
  formSubmit:function(e){
    var that = this
    wx.request({
      url: that.data.publicUrl + 'pj_add',
      method: 'POST',
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      data: {
        pj_uid: wx.getStorageSync('uid'),
        content: e.detail.value.content,
        order_id: that.data.order_id,
        title: that.data.title,
        bpj_uid: that.data.bpj_uid
      },
      success: function (res) {
        if (res.data.message == 'OK'){
          wx.showToast({
            title: '评价成功',
            icon:'none',
          })
          wx.reLaunch({
            url: '/pages/person/person',
          })
        }
        
      },
      fail: function (res) {
        console.log('加载失败')
      }
    }) 
  },
})